﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using ThoiTrang.Business;
using ThoiTrang.Entities;

public partial class surveycomment : System.Web.UI.Page
{
    #region Properties
    protected string StrQuestion
    {
        get
        {
            if (String.IsNullOrEmpty(Request[FOConstants.QSP_QUESTION])) return string.Empty;
            return Request[FOConstants.QSP_QUESTION];
        }
    }

    protected string Qid
    {
        get
        {
            if (String.IsNullOrEmpty(Request[FOConstants.QSP_QID])) return string.Empty;
            return Request[FOConstants.QSP_QID];
        }
    }

    protected string RqSurvey
    {
        get
        {
            if (String.IsNullOrEmpty(Request[FOConstants.QSP_RQSURVEY])) return string.Empty;
            return Request[FOConstants.QSP_RQSURVEY];
        }
    }
    #endregion

    protected override void OnInit(EventArgs e)
    {
        btnCommit.Click += new EventHandler(btnCommit_Click);
        base.OnInit(e);
    }

    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void btnCommit_Click(object sender, EventArgs e)
    {
        try
        {
            a_Surveys_Comment cm = new a_Surveys_Comment();
            cm.QID = int.Parse(Qid);
            cm.Comment = txtContent.Value;
            cm.DateCreated = DateTime.Now;
            cm.CookieID = String.IsNullOrEmpty(Request[FOConstants.QSP_CKID]) ? "" : Request[FOConstants.QSP_CKID];
            a_Surveys_CommentService.Createa_Surveys_Comment(cm);
            Response.Redirect(string.Format("reportsurvey.aspx?ckid={0}&sid={1}&rqsurvey={2}", SessionManager.GetCookie(), Qid, RqSurvey));
        }
        catch (Exception ex)
        {

        }
        
    }
}
